

<template>
    <div id="header">
        <div class="content-wrapper">
            <div class="avatar">
                <img :src="seller.avatar" alt="商品logo" width="64" height="64">
            </div>
            <div class="content">
                <div class="title">
                    <span class="brand"></span>
                    <span class="name">{{seller.name}}</span>
                </div>
                <div class="desc">{{seller.description}} / {{seller.deliveryTime}}分钟送达</div>
                <ul class="supports" v-if="seller.supports">
                    <li v-for="(item,index) in seller.supports" class="support">
                        <span class="icon" :class="classMap[item.type]"></span>
                        <span class="text">{{item.description}}</span>
                    </li>
                </ul>
                <div class="supports-count" v-if="seller.supports" @click="show">
                    <span class="count">{{seller.supports.length}}个</span>
                    <i class="icon-keyboard_arrow_right"></i>
                </div>
            </div>
        </div>
        <div class="bulletin-wrapper" @click="show">
            <span class="bulletin-title"></span>
            <span class="bulletin-text">{{seller.bulletin}}</span>
            <i class="icon-keyboard_arrow_right"></i>
        </div>
        <div class="background">
            <img :src="seller.avatar" alt="" width="100%" height="100%">
        </div>
        <transition name="fade">
            <div class="detail" v-show="detailShow">
                <div class="detail-wrapper clearfix">
                    <div class="detail-main">
                        <h1 class="name">{{seller.name}}</h1>
                        <div class="star-wrapper">
                            <star :size="48" :score="seller.score"></star>
                        </div>
                        <div class="title">
                            <div class="line"></div>
                            <div class="text">优惠信息</div>
                            <div class="line"></div>
                        </div>
                        <ul class="supports" v-if="seller.supports">
                            <li v-for="(item,index) in seller.supports" class="support">
                                <span class="icon" :class="classMap[item.type]"></span>
                                <span class="text">{{item.description}}</span>
                            </li>
                        </ul>
                        <div class="title">
                            <div class="line"></div>
                            <div class="text">商家公告</div>
                            <div class="line"></div>
                        </div>
                        <div class="bulletin">
                            <p class="content">{{seller.bulletin}}</p>
                        </div>
                    </div>
                </div>
                <div class="detail-close" @click="hide">
                    <i class="icon-close"></i>
                </div>
            </div>
        </transition>
    </div>
</template>



<script>

import Star from 'components/star/star.vue';

export default {
    data(){
        return {
            detailShow: false
        }
    },
    props: {
        seller: {
            type: Object,
            default: {}
        }
    },
    created(){
        this.classMap = ['decrease','discount','special','invoice','guarantee'];
    },
    methods: {
        show(){
            this.detailShow = true;
        },
        hide(){
            this.detailShow = false;
        }
    },
    components: {
        'star': Star
    }
}

</script>




<style scoped lang="stylus" rel="stylesheet/stylus">
    
    @import '~common/stylus/mixin.stylus';

    #header{
        position: relative;
        background: rgba(7,17,27,0.5);
        color: #fff;
        overflow: hidden;
        .content-wrapper{
            position: relative;
            padding: 24px 12px 18px 24px;
            font-size: 0;
            .avatar{
                display: inline-block;
                vertical-align: top;
                img{
                    border-radius: 2px;
                    -webkit-border-radius: 2px;
                }
            }
            .content{
                display: inline-block;
                margin-left: 9px;
                .title{
                    margin: 2px 0 8px 0;
                    .brand{
                        width: 30px;
                        height: 18px;
                        display: inline-block;
                        bg-image('brand');
                        background-repeat: no-repeat;
                        background-size: 100%;
                        vertical-align: top;
                    }
                    .name{
                        font-size: 16px;
                        color: rgb(255,255,255);
                        margin-left: 6px;
                        line-height: 18px;
                    }
                }
                .desc{
                    font-size: 12px;
                    line-height: 12px;
                    margin-bottom: 5px;
                }
                .supports{
                    font-size: 12px;
                    height: 15px;
                    line-height: 15px;
                    overflow: hidden;
                    .support{
                        margin-bottom: 5px;
                    }
                    .icon{
                        width: 12px;
                        height: 12px;
                        background-repeat: no-repeat;
                        background-size: 100%;
                        display: inline-block;
                        vertical-align: middle;
                        &.decrease{
                            bg-image('decrease_1');
                        }
                        &.discount{
                            bg-image('discount_1');
                        }
                        &.guarantee{
                            bg-image('guarantee_1');
                        }
                        &.invoice{
                            bg-image('invoice_1');
                        }
                        &.special{
                            bg-image('special_1');
                        }
                    }
                    .text{
                        line-height: 12px;
                        font-size: 10px;
                    }
                }
                .supports-count{
                    position: absolute;
                    bottom: 18px;
                    right: 12px;
                    height: 24px;
                    padding: 0 8px;
                    background: rgba(0,0,0,0.2);
                    text-align: center;
                    border-radius: 14px;
                    -webkit-border-radius: 14px;
                    .count{
                        display: inline-block;
                        font-size: 10px;
                        line-height: 24px;
                    }
                    .icon-keyboard_arrow_right{
                        display: inline-block;
                        font-size: 10px;
                        margin-left: 2px;
                        line-height: 24px;
                    }
                }
            }
        }
        .bulletin-wrapper{
            position: relative;
            height: 28px;
            line-height: 28px;
            background: rgba(7,17,27,0.2);
            padding: 0 22px 0 12px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            .bulletin-title{
                display: inline-block;
                width: 22px;
                height: 12px;
                bg-image('bulletin');
                background-repeat: no-repeat;
                background-size: 100%;
                margin-top: 8px;
                vertical-align: top;
            }
            .bulletin-text{
                font-size: 12px;
                margin: 0 4px;
                vertical-align: top;
            }
            .icon-keyboard_arrow_right{
                position: absolute;
                font-size: 12px;
                right: 10px;
                bottom: 7px;
            }
        }
        .background{
            position: absolute;
            top: 0;
            left: 0;
            z-index: -1;
            width: 100%;
            height: 100%;
            filter: blur(5px);
        }
        .detail{
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 100;
            width: 100%;
            height: 100%;
            background: rgba(7,17,27,0.8);
            backdrop-filter: blur(10px);
            &.fade-enter-active, &.fade-leave-active{
                transition: all 1s ease;
                -webkit-transition: all 1s ease;
                opacity: 1;
                -webkit-opacity: 1;
            }
            &.fade-enter, &.fade-leave-to{
                -webkit-opacity: 0;
                opacity: 0;
                -webkit-transform: translate3d(100%, 0, 0);
                transform: translate3d(100%, 0, 0);
            }
            .detail-wrapper{
                width: 100%;
                min-height: 100%;
                .detail-main{
                    margin-top: 64px;
                    padding-bottom: 64px;
                    .name{
                        font-size: 16px;
                        line-height: 16px;
                        font-weight: bold;
                        text-align: center;
                    }
                    .star-wrapper{
                        text-align: center;
                        margin-top: 18px;
                        padding: 2px 0;
                    }
                    .title{
                        width: 80%;
                        margin: 20px auto;
                        display: flex;
                        .line{
                            flex: 1;
                            position: relative;
                            top: -7px;
                            border-bottom: rgba(255,255,255,0.4) solid 1px;
                        }
                        .text{
                            font-size: 14px;
                            padding: 0 10px;
                            font-weight: bold;
                        }
                    }
                    .supports{
                        width: 80%;
                        margin: 0 auto;
                        .support{
                            margin: 12px 0 12px 12px;
                            .icon{
                                width: 18px;
                                height: 18px;
                                background-size: 100%;
                                background-repeat: no-repeat;
                                display: inline-block;
                                vertical-align: top;
                                &.decrease{
                                    bg-image('decrease_2');
                                }
                                &.discount{
                                    bg-image('discount_2');
                                }
                                &.guarantee{
                                    bg-image('guarantee_2');
                                }
                                &.invoice{
                                    bg-image('invoice_2');
                                }
                                &.special{
                                    bg-image('special_2');
                                }
                            }
                            .text{
                                font-size: 12px;
                                line-height: 12px;
                                margin-left: 6px;
                            }
                        }
                    }
                    .bulletin{
                        width: 80%;
                        margin: 0 auto;
                        .content{
                            font-size: 12px;
                            line-height: 2;
                            letter-spacing: 1px;
                        }
                    }
                }
            }
            .detail-close{
                position: relative;
                width: 32px;
                height: 32px;
                font-size: 32px;
                margin: -64px auto 0 auto;
                clear: both;
            }
        }
    }

</style>




